/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */

package xowl.interpreter.frontends.owlxml;

/**
 *
 * @author Laurent WOUTERS
 */
public class VariableLoader {
    private static final String attrName = "name";

    public static xowl.lang.actions.CodeVariable load(org.w3c.dom.Node node, xowl.interpreter.frontends.LexicalContext context) {
        String name = node.getNodeName();
        if (name.equals(xowl.interpreter.frontends.VocActions.expCodeVariable)) return load_CodeVariable(node, context);
        return null;
    }
    private static xowl.lang.actions.CodeVariable load_CodeVariable(org.w3c.dom.Node node, xowl.interpreter.frontends.LexicalContext context) {
        org.w3c.dom.Node attr = node.getAttributes().getNamedItem(attrName);
        if (attr != null)
            return context.resolveCode(attr.getNodeValue());
        return null;
    }
}
